package cn.sxgan.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * @Description: 响应状态枚举
 * @Author: sxgan
 * @Date: 24/8/1 15:11
 * @Version: 1.0
 **/
@Getter
@AllArgsConstructor
public enum ResStatusEnum {
    // 请求相关
    SUCCESS(200, "success"),
    FAIL(500, "failed"),
    HTTP_STATUS_200(200, "ok"),
    HTTP_STATUS_400(400, "request error"),
    HTTP_STATUS_401(401, "no authentication"),
    HTTP_STATUS_403(403, "no authorities"),
    HTTP_STATUS_500(500, "server error"),
    ADD_STATUS_200(200, "新增成功"),
    ADD_STATUS_500(500, "新增失败"),
    DELETE_STATUS_200(200, "删除成功"),
    DELETE_STATUS_500(500, "删除失败"),
    UPDATE_STATUS_200(200, "更新成功"),
    UPDATE_STATUS_500(500, "更新失败"),
    QUERY_STATUS_200(200, "查询成功"),
    QUERY_STATUS_500(500, "查询失败"),
    BIND_STATUS_200(200, "绑定成功"),
    BIND_STATUS_500(500, "绑定失败"),
    
    // 账户异常
    EXCEPTION_STATUS_700(700, "账号未登录"),
    EXCEPTION_STATUS_701(701, "账号未注册"),
    EXCEPTION_STATUS_702(702, "注册失败"),
    EXCEPTION_STATUS_703(703, "账号密码错误"),
    EXCEPTION_STATUS_704(704, "注册邮箱、密码、验证码不能为空"),
    EXCEPTION_STATUS_705(705, "你填写的验证码有误"),
    EXCEPTION_STATUS_706(706, "该邮箱已经注册，请前往登陆"),
    EXCEPTION_STATUS_707(707, "更新失败"),
    EXCEPTION_STATUS_708(708, "图片验证码已过期，请重新刷新"),
    EXCEPTION_STATUS_709(709, "邮箱验证码已过期，请重新请求验证码"),
    
    
    // 邮件发送异常
    EXCEPTION_STATUS_711(711, "邮件为空"),
    EXCEPTION_STATUS_712(712, "邮件发送失败，系统异常"),
    
    // 菜单角色异常
    EXCEPTION_STATUS_720(720, "角色列表查询失败"),
    EXCEPTION_STATUS_721(721, "添加角色失败"),
    EXCEPTION_STATUS_722(722, "用户角色绑定异常"),
    EXCEPTION_STATUS_723(723, "未查询到用户"),
    EXCEPTION_STATUS_724(724, "未查询到角色"),
    EXCEPTION_STATUS_725(725, "添加菜单异常"),
    EXCEPTION_STATUS_726(726, "绑定角色菜单异常"),
    EXCEPTION_STATUS_727(727, "当前所选菜单已绑定至用户，无需绑定"),
    EXCEPTION_STATUS_728(728, "未查询到菜单"),
    
    // 业务参数请求异常
    EXCEPTION_STATUS_900(900, "请求参数异常，参数为空或参数违法！"),
    // 业务错误
    EXCEPTION_STATUS_901(901, "非系统用户，无法查询系统用户列表"),
    EXCEPTION_STATUS_902(902, "非系统用户，无法查询角色菜单列表"),
    EXCEPTION_STATUS_903(903, "非当前用户邮箱，无法进行修改"),
    EXCEPTION_STATUS_911(911, "删除失败，请使用系统管理账户删除"),
    EXCEPTION_STATUS_912(912, "系统不存在此用户"),
    EXCEPTION_STATUS_913(913, "当前账号已被锁定，请联系管理员进行解锁"),
    EXCEPTION_STATUS_932(932, "删除失败，无法删除自身账户"),
    EXCEPTION_STATUS_999(999, "业务错误！");
    
    public static final List<ResStatusEnum> EXCEPTION_STATUS_ALL = Collections.unmodifiableList(
            Arrays.asList(EXCEPTION_STATUS_700, EXCEPTION_STATUS_701, EXCEPTION_STATUS_702, EXCEPTION_STATUS_703,
                    EXCEPTION_STATUS_704, EXCEPTION_STATUS_705, EXCEPTION_STATUS_706, EXCEPTION_STATUS_707,
                    EXCEPTION_STATUS_711, EXCEPTION_STATUS_712, EXCEPTION_STATUS_900, EXCEPTION_STATUS_999)
    );
    
    /* exception code*/
    private final Integer code;
    
    /* exception msg.*/
    private final String msg;
    
}